#!/bin/bash

if [ `whoami` != "root" ]; then
    echo "需要以root用户执行"
    exit -1;
fi

echo 开始替换内核环境-----------------------------------
if [ ! -f Image ]; then
    echo Image 文件不存在
    exit -1;
fi

correct_md5=5b2cd10d1f41be2e758dd571a49a2327


md=$(md5sum Image | awk '{print $1}')
if [ "$md" = "$correct_md5" ]; then
    echo "MD5验证通过: $md"
    dd if=Image of=/dev/mmcblk0 count=86016 seek=2060 bs=512
    # dd if=Image of=/dev/mmcblk0 count=86016 seek=122892 bs=512
    echo 替换内核完成-----------------
fi

